﻿using System;

namespace Klinkby.PipesAndFilters
{
    public static class FilterEx
    {
        public static IFilter<T1, T3> ConnectTo<T1, T2, T3>(this IFilter<T1, T2> me, IFilter<T2, T3> next)
        {
            if (next == null)
                throw new ArgumentNullException("next");
            return new ComboFilter<T1, T2, T3>(me, next);
        }

        public static IFilter<T1, T3[]> ConnectTo<T1, T2, T3>(this IFilter<T1, T2> me, params IFilter<T2, T3>[] next)
        {
            if (next == null)
                throw new ArgumentNullException("next");
            return new ComboFilter<T1, T2, T3[]>(me, new SplitterFilter<T2, T3>(next));
        }
    }
}
